<?php
namespace App\Models\Chain\PointCash;



use App\Constants\CreditLogConstant;
use App\Models\Factory\IdentityCreditFactory;
use App\Models\Factory\InviteFactory;
use App\Models\Chain\AbstractHandler;
use App\Models\Factory\UserCreditFactory;

/**
 * 更新用户积分表
 * Class CreateCreditLogAction
 * @package App\Models\Chain\Identity
 */

class UpdateUserCreditAction extends AbstractHandler
{
    private $params = array();

    protected $error = array('error' => '更新积分表失败', 'code' => 7011);


    public function __construct($params)
    {
        $this->params = $params;
    }

    public function handleRequest()
    {
        if ($this->UpdateUserCredit($this->params) == true) {
            $this->setSuccessor(new CreateIntegralExchangeAction($this->params));
            return $this->getSuccessor()->handleRequest();
        } else {
            return $this->error;
        }
    }


    //更新用户积分表
    public function UpdateUserCredit($params)
    {


       $result = UserCreditFactory::updateCredit($params);

        return $result;

    }


}